<template>

  <div class=" studentRegInfo">

    

      <div class='formPage' style="border:none !important;padding:0">
        <el-form ref="form" label-width="100px" :inline="true" class="theForm">


          <div class="formFlex3Container">

            <el-form-item label="学号">
              {{ info?.studentId }}
            </el-form-item>

            <el-form-item label="姓名" prop="name">
              {{ info?.name }}
            </el-form-item>

            <el-form-item label="性别" prop="genderId">
              <span v-if="info?.genderId == '1'">
                男
              </span>
              <span v-if="info?.genderId == '2'">
                女
              </span>
            </el-form-item>

            <el-form-item label="类别">
              {{ getPclassName(info?.pclassId) }}
            </el-form-item>



            <el-form-item label="学院" prop="collegeId">
              <span v-if='info?.dictCollege'>
                {{ info.dictCollege.shortname }}
              </span>
            </el-form-item>


            <el-form-item label="年级" prop="cellPhone">
              {{ info?.grade }}
            </el-form-item>

            <el-form-item label="手机号码" prop="cellPhone">
              {{ info?.mobilephone }}
            </el-form-item>


            <el-form-item label="专业" prop="cellPhone">
              {{ info?.dictMajor.major }}
            </el-form-item>

            <el-form-item label="班级" prop="cellPhone">
              {{ info?.clazz }}
            </el-form-item>


            
            <el-form-item label="学籍状态">
              <span style="color:blue"> {{ getStatusName(info?.statusId) }}</span>
            </el-form-item>

            <el-form-item label="注册状态" style="width:66.666%">
              <span style="color:blue" v-if="isReg == '1'"> 已注册</span>
              <span style="color:red" v-if="isReg == '0'"> 未注册</span>
            </el-form-item>

            <slot />

          </div>





        </el-form>

      </div>
  

    <card title="注册记录" v-if="regList">
      <el-table :data="regList">
          <el-table-column label='学期' prop="term" min-width="100" />
          <el-table-column label='注册日期' prop="regTime" min-width="100"/>
          <el-table-column label='学号' prop="studentId" min-width="100"/>
          <el-table-column
        align="right"
        min-width="100"
        label="缓缴金额"
        prop="amount"
      >
        <template #default="scope">
          {{getDeferfee(scope.row)}}
        </template>
      </el-table-column>
        </el-table>
    </card>

  </div>
</template>

<style scoped lang="scss">
.studentRegInfo {
  .sectiontitle {
    text-align: left;
    line-height: 50px;
    font-size: 14px;
    font-weight: bold;
  }

  td.noTopBorder {
    border-top: 0 !important;
  }

  .toolbar {
    display: flex;
    margin-bottom: 10px;
  }

  .tableInfoPage {
    background: #fff;
    padding: 0;
    border-radius: 3px;

  }

  .tableInfo {
    width: 1000px;
    border-collapse: collapse;
  }

  .tableInfo .subTitle {
    font-weight: bold;
  }

  .tableInfo th {
    color: #909399;
    background: #fafafa;
  }

  .tableInfo td,
  .tableInfo th {
    border: 1px solid #e6ebf5;
    padding: 12px;
    font-size: 14px;
    text-align: left;
  }

  .tableInfo td {
    color: #606266;
  }

  .toolbar .left {
    width: 100px;
    flex-grow: 1;
  }

  .toolbar .right {
    width: 100px;
  }
}
</style>


<script setup lang="ts">

import { defineProps } from 'vue'
import { getStatusName, getPclassName } from '@/service/StudentService.ts'
//@ts-ignore
import card from '@/components/card.vue'

interface StudentInfo {
  info?: Student,
  isReg?:string,
  regList?:any
}


//@ts-ignore
function getDeferfee(row){
  var regExtend = row.regExtend;
  var amount = 0;

  if(regExtend){
    if(regExtend.amount1) amount += regExtend.amount1;
    if(regExtend.amount2) amount += regExtend.amount2;
  }

  return amount.toFixed(2);
}

defineProps<StudentInfo>();

</script>
